package com.mindao.app.ued.demo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.mindao.app.ea.demo.InfDemo;
import com.mindao.app.ea.demo.ParentDemo;
import com.mindao.app.ea.model.Organize;
import com.mindao.app.ea.model.Role;
import com.mindao.app.ea.model.Rolegroup;
import com.mindao.app.ea.model.Systempara;
import com.mindao.app.ea.model.User;

@Component("impEaUed")
public class ImpEaUed extends ParentDemo implements InfDemo {
	private final Logger log = LoggerFactory.getLogger(ImpEaUed.class);

	public void initData() throws Exception {
		testData();
	}

	@Override
	public void testData() throws Exception {
		if (baseDao.find(" from User ").size() == 0) {
			
 
	  
			Systempara sp21 = create_systempara( "学校","school", "jinan", "暨南大学",10L);
			Systempara sp22 = create_systempara( "学校","school", "gongye", "广州工业大学",20L);
			Systempara sp23 = create_systempara( "学校","school", "kemao", "科技贸易",30L);
			Systempara sp24 = create_systempara( "学校","school", "hnlg", "华南理工",40L);
			Systempara sp25 = create_systempara( "学校","school", "zhongkai", "仲凯",50L);
			Systempara sp26 = create_systempara( "学校","school", "wuyi", "五邑大学",60L);
			Systempara sp27 = create_systempara( "学校","school", "gongshang", "广州工商大学",70L);	
			Systempara sp28 = create_systempara( "学校","school", "guanghang", "广航大学",80L);
			Systempara sp29 = create_systempara( "学校","school", "huashi", "华南师范大学",90L);
			Systempara sp30 = create_systempara( "学校","school", "guangzhongyi", "广中医药大学",100L);
			Systempara sp31 = create_systempara( "学校","school", "guangwai", "广州外语大学",110L);
			Systempara sp32 = create_systempara( "学校","school", "gongmao", "工贸",120L);
						
			Organize o1 = create_organize("公司架构", "department", null);
			Organize o11 = create_sub_organize(o1,"敏道信息科技有限公司", "qushi", null);		
			Organize o111 = create_sub_organize(o11,"教学部", "train",null );
			Organize o112 = create_sub_organize(o11,"市场部", "market",null );		
			Organize o113 = create_sub_organize(o11,"项目部", "project",null );		
			User admin = create_user("admin", "系统管理员", "1324567890","admin@qq.com", "");
			User user_1 = create_user("test", "test", "18688385892","test@qq.com", "");
 
//			User admin = create_user("admin", "系统管理员", "1324567890","admin@qq.com", "");
//			User user_xixi = create_user("xixi", "习席", "323232","", "");
//			User user_hujun = create_user("hujun", "胡军", "323232","", "");	
//			User user_liuhua = create_user("liuhua", "刘华", "234455","", "");
//			User user_limi= create_user("limi", "黎米", "234455","", "");
//			
//			User user_wangfei = create_user("wangfei", "王非", "323232","", "");
//			User user_hanchun= create_user("huchun", "胡春", "234455","", "");
//			User user_lili = create_user("lili", "李丽", "234455","", "");		
//			User user_zhangli = create_user("zhangli", "张丽", "234455","", "");		
//			Organize o1 = create_organize("部门架构", "department", null);
//			Organize o11 = create_sub_organize(o1,"xx企业", "xx", null);		
//			Organize o111 = create_sub_organize(o11,"生产部", "product",null );
//			Organize o112 = create_sub_organize(o11,"客服", "surpport",null );
//			
//			Rolegroup r1 = create_rolegroup("部门", "rolegroup-department");
//			Rolegroup rolegoupr_ceo = create_sub_rolegroup(r1, "CEO", "CEO");
//			Rolegroup r10 = create_sub_rolegroup(rolegoupr_ceo, "部门经理", "department-manager");
//			Rolegroup r14 = create_sub_rolegroup(r10, "员工", "member");
//			
//			Role role_product_ceo=createRole(o11.getId().toString(), rolegoupr_ceo.getId().toString());
//			Role role_product_manager=createRole(o111.getId().toString(), r10.getId().toString());
//			Role role_product_member=createRole(o111.getId().toString(), r14.getId().toString());
//	
//			Role role_surpport_manager=createRole(o112.getId().toString(), r10.getId().toString());
//			Role role_surpport_member=createRole(o112.getId().toString(), r14.getId().toString());
//			
//			
//			role_product_manager.setParentModel(role_product_ceo);
//			role_surpport_manager.setParentModel(role_product_ceo);
//			role_product_member.setParentModel(role_product_manager);
//			role_surpport_member.setParentModel(role_surpport_manager);
//			
//		
//			role_product_ceo.getUsers().add(user_xixi);
//			role_product_manager.getUsers().add(user_hujun);
//			role_product_member.getUsers().add(user_liuhua);
//			role_product_member.getUsers().add(user_limi);
//			
//			role_surpport_manager.getUsers().add(user_wangfei);
//			role_surpport_member.getUsers().add(user_hanchun);
//			role_surpport_member.getUsers().add(user_lili);
//			role_surpport_member.getUsers().add(user_zhangli);
			Rolegroup r2 = create_rolegroup("项目", "rolegroup-project");
			Rolegroup r21 = create_sub_rolegroup(r2, "项目经理", "project-manager");
			Rolegroup r211 = create_sub_rolegroup(r21, "领域主管", "group-leader");
			Rolegroup r2111 = create_sub_rolegroup(r211, "组长", "team-leder");
			Rolegroup r21111 = create_sub_rolegroup(r2111, "成员", "team-member");
			Rolegroup r211111 = create_sub_rolegroup(r2111, "第三方成员", "helper");		
		
	 
		
		
		}

	}
}
